package com.xiangdao.service;

import com.xiangdao.dao.UserDao;
import com.xiangdao.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service
public class UserService {
    @Autowired
    UserDao userDao;

    /**
     * 添加用户
     * @param user
     * @return
     */
    public int addUser(User user) {
        return userDao.addUser(user);
    }
    public Integer updateUser(User user){
        return userDao.updateUser(user.getName(),user.getEmail(),user.getBirthday(),user.getSex(),user.getCity(),
                user.getSignature(),user.getSchool(),user.getEnrollmenttime(),user.getIntroduction(),
                user.getQq(),user.getStudentid(),user.getImage());
    }
    /**
     * 查找用户名
     * @param name
     * @return
     */
    public User getUserByUsername(String name) {
        return userDao.getUserByUsername(name);
    }

    //查找账号密码
    public String getPasswordByName(String name) {
        return userDao.getPasswordByName(name);
    }

//    public String getUsernameById(Integer id){return userDao.getUsernameById(id);}
}
